package com.plant.college.controller;

import com.plant.college.domain.Video;
import com.plant.college.feign.UserFeign;
import com.plant.college.service.VideoService;
import com.plant.common.domain.User;
import com.plant.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("videos")
@Slf4j
public class VideoController {

    @Autowired
    VideoService videosService;

    @Autowired
    UserFeign userFeign;

    @GetMapping("findAll")
    public Result getAllVideos() {
       List<Video> videosList = videosService.getAllVideos();
       log.info("视频:{}",videosList.toString());
        return Result.ok(videosList) ;
    }

    @GetMapping("findById/{id}")
    public Result findById(@PathVariable Long id) {
        Video video = videosService.findById(id);

        return Result.ok(video) ;
    }
}
